"strictObjectIDCoercion": true on role-mapping.json#3198
Conversation
How the json file is, loopback developers are currently unable to query RoleMappings by principalId, since most connectors (mongodb in my case) will overwrite the type of the principalId for the query to an ObjectId, which is incorrect behavior. principalId is a string, as per this definition. So having the query cast to an ObjectId always returns no matches.
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
Can one of the admins verify this patch? |
3 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
@slnode ok to test |
|
Hello @luncht1me, thank you for the contribution. What are the consequences of your change for existing applications? I am concerned that this may be a breaking change. We also require most changes to be accompanied with a test that fails before the change is made and passes afterwards. Can you add one please? |
|
@fabien @Amir-61 @jannyHou the flag "strictObjectIDCoercion" was added by loopbackio/loopback-connector-mongodb#297 which you authored/reviewed, could you please take a look at this related pull request too? @fabien are you using loopback's built-in auth system? How do you fix object-id coercion for models like RoleMapping? Also, is there any reasonably easy way for LoopBack users to enable |
|
@bajtos this pull request looks fine - I have the following in a boot script right now: AFAIK this is the only built-in model that was affected by this option. |
|
@fabien great! thank you for chiming in. My main concern is about backward compatibility. If we enable |
|
@bajtos I think your concern is valid, as Perhaps a migration script can be provided, though? |
|
I see. In that case, let's enable this setting only for new projects created using I am closing this patch as rejected.
That would be nice, indeed. I think this belongs to our documentation - instructions on how to enable |
Description
How the json file is, loopback developers are currently unable to query RoleMappings by principalId, since most connectors (mongodb in my case) will overwrite the type of the principalId for the query to an ObjectId, which is incorrect behavior.
principalId is a string, as per this definition. So having the query cast to an ObjectId always returns no matches.
Related issues